package com.crm.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.crm.common.core.domain.entity.SysUser;
import com.crm.manager.domain.Clue;
import com.crm.manager.domain.dto.CluePageQueryDto;
import com.crm.manager.domain.dto.CluePoolPageQueryDto;
import com.crm.manager.domain.dto.ClueStatisticPageDto;
import com.crm.manager.domain.vo.ClueStatisticPageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClueMapper extends BaseMapper<Clue> {
    List<Clue> pageQuery(CluePageQueryDto dto);


    // 根据userId查询SysUser表
    @Select("select * from sys_user where user_id = #{userId}")
    SysUser selectSysUserByUserId(Long userId);

    // 根据ids获得线索集合
    List<Clue> selecyByIds(@Param("ids") List<Long> ids);

    // 线索池的分页查询
    List<Clue> poolPageQuery(CluePoolPageQueryDto dto);

    // 新增线索数量
    Integer getEveryDayClueCount(String timeInterval);

    // 获得当前线索的总数量
    Integer getCurrentClueCount(String timeInterval);

    // 线索统计分页查询
    List<ClueStatisticPageVO> clueStatisticPageQuery(ClueStatisticPageDto dto);
}
